package com.cet.lxf.collection.test07;

import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

/**
 * @program: algorithm
 * @description: 从内存读取一个字节流：
 * @author: 陈恩涛
 * @create: 2021-08-10 11:29
 **/
public class Main {
    public static void main(String[] args) throws IOException {
        /*
        *  # test
        *  course=java
        *  last_open_date=2019-08-07T12:35:01
        *
        * */
        String settings = "# test" + "\n" + "course=Java" + "\n" + "last_open_date=2019-08-07T12:35:01";
        InputStream input = new ByteArrayInputStream(settings.getBytes("UTF-8"));
        Properties props = new Properties();
        props.load(input);

        System.out.println("course: " + props.getProperty("course"));
        System.out.println("last_open_date: " + props.getProperty("last_open_date"));
        System.out.println("last_open_file: " + props.getProperty("last_open_file"));
        System.out.println("auto_save: " + props.getProperty("auto_save", "60"));
    }
}
